package com.itfreer.power.service.organize;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.imp.DictionaryServiceImp;
import com.itfreer.form.dictionary.base.DictionaryItem;
import com.itfreer.power.dao.organize.DepartmentDao;
import com.itfreer.power.entity.organize.DepartmentEntity;

/**
 * 部门管理实现类
 */
@Component("departmentService")
public class DepartmentServiceBase extends DictionaryServiceImp<DepartmentEntity> implements DepartmentService {
	
	@Autowired
	private DepartmentDao departmentDao;

	@Override
	public String getDictionaryName() {
		return "p_department";
	}

	@Override
	protected DictionaryItem convert(DepartmentEntity entity) {
		DictionaryItem toEntity = new DictionaryItem();
		BeanUtils.copyProperties(entity, toEntity);
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "id,code,display,valid,order";
	}

	@Override
	protected BaseDao<DepartmentEntity> getDao() {
		return departmentDao;
	}
}
